<?php
/**
 * Description
 * 
 * PHP version 7
 * 
 * @category Custom
 * @package  Custom
 * @author   ryu <mo5467@126.com>
 * @date     2020-04-23 01:07:32
 * @lastTime 2020-05-01 22:58:01
 * @license  https://opensource.org/licenses/MIT MIT License
 * @link     none
 */

namespace Test\Unit;

use Design\Creational\Prototype\BarBookPrototype;
use Design\Creational\Prototype\FooBookPrototype;

class PrototypeTest extends \Test\BaseTest
{


    public function testCanGetFooBarBook()
    {
        $barBook = new BarBookPrototype();
        $fooBook = new FooBookPrototype();

        for ($i = 0; $i < 5; $i++) {
            $book = clone $barBook;
            $book->setTitle('Bar'.$i);

            $this->assertInstanceOf(BarBookPrototype::class, $book);
        }

        for ($i = 0; $i < 5; $i++) {
            $book = clone $fooBook;
            $book->setTitle('Foo'.$i);

            $this->assertInstanceOf(FooBookPrototype::class, $book);
            $this->assertSame('Foo'.$i, $book->getTitle());
        }

    }//end testCanGetFooBarBook()


}//end class
